<template>
  <div class="table">
    <el-table ref="tableDataRef" :data="tableData"  show-overflow-tooltip>
      <el-table-column type="index" label="序号" width="70" />
      <el-table-column prop="jobName" label="岗位名称" />
      <el-table-column prop="jobCode" label="岗位编号" />
      <el-table-column prop="positionLevel" label="职级">
      </el-table-column>
      <el-table-column prop="salaryRange" label="薪酬范围" />
      <el-table-column prop="jobResponsibilities" label="岗位职责" />
      <el-table-column prop="qualification" label="任职条件" />
      <el-table-column prop="jobKeywords" label="岗位关键词" />
      <el-table-column prop="createPersonName" label="创建人" />
      <el-table-column prop="createTime" label="创建时间" />
      <el-table-column prop="jobStatus" label="状态">
      </el-table-column>
      <el-table-column label="操作" width="200" >
        <template #default="scope">
          <el-button text type="info" class="other-btn" @click="handleInfo(scope.row)">查看</el-button>
          <el-button class="other-btn" type="primary" text v-hasPermi="['system:listener:Registration']"
            @click="handleGetApplication(scope.row)">编辑</el-button>
          <el-button @click="changeStatus(scope.row)" v-if="scope.row.statusVal == 0" class="other-btn" type="primary" text>停用</el-button>
          <el-button @click="changeStatus(scope.row)" v-if="scope.row.statusVal == 1" class="other-btn" type="primary" text>启用</el-button>
        </template>
      </el-table-column>
    </el-table>
    <Pagination class="pagination" :total="pagination.total" :page="pagination.page" :limit="pagination.limit"
      :pageSizes="pagination.pageSizes" @handleSizeChange="sizeChange" @handleCurrentChange="currentChange">
    </Pagination>
  </div>
</template>

<script setup>
import Pagination from "@/components/Pagination/pageination.vue";
const emit = defineEmits([
  "handleInfo",
  "sizeChange",
  "currentChange",
  "handleGetApplication",
  "handleSelectionChange",
  "changeStatus",
]);

const props = defineProps({
  isShowBtn: Boolean,
  tableData: Array,
  currentTabs: String,
  pagination: {
    type: Object,
    required: true,
    default: () => ({
      total: 10,
      page: 1,
      limit: 10,
      pageSizes: 10,
    }),
  },
});

// 查看
const handleInfo = (row) => {
  emit("handleInfo", row);
};
// 编辑
const handleGetApplication = (row) => {
  emit("handleGetApplication", row);
};
// 停用
const changeStatus = (row) => {
  emit("changeStatus", row);
};
const sizeChange = (size) => {
  console.log(size, "size");
  emit("sizeChange", size);
};
const currentChange = (page) => {
  console.log(page, "1");
  emit("currentChange", page);
};
</script>
<style scoped>
.pagination {
  margin-top: 15px;
}
</style>
